package cn.enited.devtools.apiaggregator.consts;


import okhttp3.MediaType;

import java.sql.Struct;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.concurrent.TimeUnit;

public final class CommonConst {

    public static final int DEFAULT_PAGE_SIZE = 10;

    public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd";
    public static final String DEFAULT_DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
    public static final DateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat(DEFAULT_DATE_PATTERN);
    public static final DateFormat DEFAULT_DATETIME_FORMAT = new SimpleDateFormat(DEFAULT_DATETIME_PATTERN);

    public static final String DEFAULT_UPLOAD_DIR_PATTERN = "yyyyMMdd";

    public static final class ZERO {
        public static final int INT = 0;
        public static final long LONG = 0L;
    }

    public static final int STR_START_INDEX = ZERO.INT;

    public static final class BOOL {
        public static final String TRUE = "true";
        public static final String FALSE = "false";
    }

    public static final String NULL = "null";

    public static final class API_ENV {
        public static final String PRODUCT = "P";
        public static final String TEST = "T";
        public static final String TRAINING = "R";
    }

    public static final class GLOBAL_PARAM_TYPE {
        public static final String HEADER = "HP";
        public static final String BODY = "BP";
    }

    public static final class ENTITY {
        public static final String ID = "id";
        public static final String BIZ_ID = "bizId";
        public static final String CREATE_DATE = "createDate";
        public static final String UPDATE_DATE = "updateDate";
        public static final String DEL_FLAG = "delFlag";
    }

    public static final class SORT {
        public static final int ASC = 1;
        public static final int DESC = -1;
    }

    public static final class REDIS {
        public static final String KEY_PREFIX = "apiagg_";
        public static final String SYNC_KEY_PREFIX = KEY_PREFIX + "sync";
        public static final String UPDATE_KEY_PREFIX = KEY_PREFIX + "update_";
    }

    public static final class HTTP_METHOD {
        public static final String HEAD = "head";
        public static final String GET = "get";
        public static final String POST = "post";
        public static final String PUT = "put";
        public static final String DELETE = "delete";
    }

    public static final class REQUEST_DATA_TYPE {
        public static final String FORM = "form";
        public static final String JSON = "json";
        public static final MediaType JSON_MEDIA_TYPE = MediaType.parse("application/json; charset=utf-8");
        public static final MediaType FORM_MEDIA_TYPE = MediaType.parse("application/x-www-form-urlencoded;charset=utf-8");
    }
}
